<template>
  <template v-for="menu in menus" :key="menu.name">
    <el-sub-menu v-if="menu.children.length" :index="menu.name">
      <template #title>
        <el-icon v-if="menu.icon"> <component :is="Icons[menu.icon]" /> </el-icon>
        <span class="text-ellipsis whitespace-nowrap overflow-hidden">{{ menu.title }}</span>
      </template>
      <SubMenuRender :menus="menu.children" />
    </el-sub-menu>
    <el-menu-item v-else :index="menu.name">
      <el-icon v-if="menu.icon"> <component :is="Icons[menu.icon]" /> </el-icon>
      <span class="text-ellipsis whitespace-nowrap overflow-hidden">{{ menu.title }}</span>
    </el-menu-item>
  </template>
</template>

<script setup lang="ts">
import * as Icons from '@/assets/icons'
import type { BreadcrumbItem } from '@/breadcrumb'

interface Props {
  menus: BreadcrumbItem[]
}

defineProps<Props>()
</script>

<style scoped lang="scss"></style>
